import {
    $get,
    $post,
    $uploadPost,
    $uploadGet
} from '@/http'
import { localDeploy } from '@/utils/global'
// 文件操作
export default {
    // 保存文件
    saveFileByKey(params, config) {
        const url = localDeploy ? '/local/saveFileByKey' : `/obs/saveFileByKey`
        return $uploadPost(url, params, config)
    },
    // 获取文件流
    getFileByKey(params, config) {
        const url = localDeploy ? '/local/getFileByKey' : `/obs/getFileByKey`
        return $uploadGet(url, params, config)
    },
    // 保存文件信息
    saveFileInfo(params) {
        const url = localDeploy ? '/local/saveFileInfo' : `/obs/saveFileInfo`
        return $post(url, params)
    },
    // 获取文件信息
    getFileInfo(params) {
        const url = localDeploy ? '/local/getFileInfo' : `/obs/getFileInfo`
        return $post(url, params)
    },
    // 删除文件信息
    deleteFileInfo(params) {
        const url = localDeploy ? '/local/deleteFileInfo' : `/obs/deleteFileInfo`
        return $post(url, params)
    }
}